package cn.wxq.daily.empdailymgforserve.service.impl;

import cn.wxq.daily.empdailymgforserve.domain.Administrative;
import cn.wxq.daily.empdailymgforserve.domain.AdministrativeAudit;
import cn.wxq.daily.empdailymgforserve.mapper.AdministrativeAuditDao;
import cn.wxq.daily.empdailymgforserve.mapper.AdministrativeDao;
import cn.wxq.daily.empdailymgforserve.service.AdministrativeAuditService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * 行政审核模块
 */
@Service
public class AdministrativeAuditServiceImpl implements AdministrativeAuditService {
    //审核接口
    @Autowired
    private AdministrativeAuditDao administrativeAuditDao;
    //行政接口
    @Autowired
    private AdministrativeDao administrativeDao;

    @Autowired(required = true)
    private Administrative administrative;

    @Override
    public int insertAuditInfo(AdministrativeAudit administrativeAudit) {
        //第一步，获取审核意见，修改行政模块对应的审核状态
//        administrativeDao.updateAdministratStatus(administrativeAudit.getLsStatus());
        administrative.setAdtrtId(administrativeAudit.getAdtrtId());
        administrative.setStatus("1");
        administrativeDao.updateAdministrative(administrative);
        //第二步，新增审核信息到审核表中
        //审核时间
        administrativeAudit.setAuditTime(new Date());
        int result = administrativeAuditDao.insertAuditInfo(administrativeAudit);
        return result;
    }
}
